const express = require('express');
const router = express.Router();

const uploader = require('../lib/multer')

/* 文件上传 */
// single函数的参数是form表单文件提交的字段
router.post('/upload', uploader.single('image'), function(req, res, next) {
	const { body, file } = req
	res.send({
		code: 0,
		msg: '上传成功',
		result: {
			url: '/images/'+file.filename
		}
	})
});



module.exports = router;